



*************
* experiment 2 roll 1 
*************

* note - the graph combines both rolls, and will only show the graph once the whole 
* of the rest of the do file is run
clear
use "data/both.dta"
set scheme plottig

*prep data
 gen five= (roll1==5)
 gen six = (roll1==0)
 gen one = (roll1==1)
 gen two = (roll1==2)
 gen three = (roll1==3)
 gen four = (roll1==4)
 
label variable five "5"
label variable four "4"
label variable three "3"
label variable two "2"
label variable one "1"
label variable six "0"

 gen five2= (roll2==5)
 gen six2 = (roll2==0)
 gen one2 = (roll2==1)
 gen two2 = (roll2==2)
 gen three2 = (roll2==3)
 gen four2 = (roll2==4)
 
 collapse (mean) roll1 roll2 five six one two three four  five2 six2 one2 two2 three2 four2 ///
 (sem) semq1= roll1 semq2= roll2   semfive=five semsix=six semone=one semtwo=two semthree=three semfour=four ///
 semfive2=five2 semsix2=six2 semone2=one2 semtwo2=two2 semthree2=three2 semfour2=four2 ///
 , by(treat)

gen hiy=roll1+1.96*semq1
gen lowy=roll1-1.96*semq1

graph twoway (bar roll1  treat if treat>20, recast(scatter) col(plr1) fxsize(100) ///
fi(50) ylabel(0(1)4) legend(off) xlabel(21 "2S" 22 "1S") ///
ylabel(0 1 2  3 4,  labcol(black)) ///
 yline(2.5, lcol(ply1) )  ytick(0(1)4.2) yline(3.47, lcol(plb1) lpat(solid))  ///
  )  ///
(rcap hiy lowy treat if treat>20 ,lc(black) ) 	, title("Mean") xtitle("")  ///
nodraw name(mean, replace) scheme(plotplainblind)

gen fiveh=five+1.96*semfive
gen fivel=five-1.96*semfive
twoway (bar five treat if treat>20 , col(plr1)  recast(scatter) fxsize(110) ///
 fi() legend(off) xlabel(21 "2S" 22 "1S") xtitle("")) ///
(rcap fiveh fivel treat if treat>20 ,lc(black) title("5")   ///
 yline(.16666667, lcol(ply1) ) yline(.3055556, lcol(plb1) lpat(solid))  ///
 ylabel(0(0.1)0.42, grid gmin gmax) ytick(0(.1).42, grid gmin gmax) ///
 name(five, replace) nodraw)
 
gen fourh=four+1.96*semfour
gen fourl=four-1.96*semfour
twoway (bar four treat if treat>20 , col(plr1)   recast(scatter) fxsize(80) ///
 fi() legend(off) xlabel(21 "2S" 22 "1S") xtitle("") ) ///
(rcap fourh fourl treat if treat>20 ,lc(black) title("4")  ///
yline(.16666667, lcol(ply1) ) yline(.25, lcol(plb1) lpat(solid))  ///
 ylabel(none) ytick(0(.1).42, grid gmin gmax) ///
nodraw name(four, replace)) 

gen threeh=three+1.96*semthree
gen threel=three-1.96*semthree
twoway (bar three treat if treat>20 , col(plr1)  recast(scatter) fxsize(80) ///
 fi() legend(off) xlabel(21 "2S" 22 "1S") xtitle("")) ///
(rcap threeh threel treat if treat>20 ,lc(black) title("3")  ///
yline(.16666667, lcol(ply1) ) yline(.19444444, lcol(plb1) lpat(solid))  ///
 ylabel(none) ytick(0(.1).42, grid gmax gmin) ///
 nodraw name(three, replace))  

gen twoh=two+1.96*semtwo
gen twol=two-1.96*semtwo
twoway (bar two treat if treat>20 , col(plr1)  recast(scatter) fxsize(80) ///
 fi() legend(off) xlabel(21 "2S" 22 "1S") xtitle("")) ///
(rcap twoh twol treat if treat>20 ,lc(black) title("2")  ///
yline(.16666667, lcol(ply1) ) yline(.13888889, lcol(plb1) lpat(solid))  ///
 ylabel(none) ytick(0(.1).42, grid gmin gmax) ///
 nodraw name(two, replace))  

gen oneh=one+1.96*semone
gen onel=one-1.96*semone
twoway (bar one treat if treat>20 , col(plr1)  recast(scatter) fxsize(80) ///
 fi() legend(off) xlabel(21 "2S" 22 "1S") xtitle("")) ///
(rcap oneh onel treat if treat>20, lc(black) title("1")  ///
yline(.16666667, lcol(ply1) ) yline(.08333333, lcol(plb1) lpat(solid))  ///
 ylabel(none) ytick(0(.1).42, grid gmin gmax) ///
  nodraw name(one, replace))  

gen sixh=six+1.96*semsix
gen sixl=six-1.96*semsix
twoway (bar six treat if treat>20 , col(plr1)  recast(scatter) fxsize(80) ///
 fi() legend(off) xlabel(21 "2S" 22 "1S") xtitle("")) ///
(rcap sixh sixl treat if treat>20, lc(black) title("0")  /// 
 yline(.16666667, lcol(ply1) ) yline(.02777778, lcol(plb1) lpat(solid))  ///
 ylabel(none) ytick(0(.1).42, grid gmin gmax) ///
	nodraw name(six, replace))  
  
gr combine mean five four three two one six, row(1) xsize(5) ysize(3) ///
 imargin(none) scale(2.8) title("1st Roll, Incentivised", size( vsmall  )) ///
 name(temp1, replace) 
 graph export "output/figure4a.pdf", as(pdf) replace

 
*********************
* Experiment 2 Roll 2
*********************
clear
use "data/both.dta", clear

*prep data
 gen five= (roll2==5)
 gen six = (roll2==0)
 gen one = (roll2==1)
 gen two = (roll2==2)
 gen three = (roll2==3)
 gen four = (roll2==4)
 
label variable five "5"
label variable four "4"
label variable three "3"
label variable two "2"
label variable one "1"
label variable six "0"

 gen five2= (roll2==5)
 gen six2 = (roll2==0)
 gen one2 = (roll2==1)
 gen two2 = (roll2==2)
 gen three2 = (roll2==3)
 gen four2 = (roll2==4)
 
 collapse (mean) roll1 roll2 five six one two three four  five2 six2 one2 two2 three2 four2 ///
 (sem) semq1= roll1 semq2= roll2   semfive=five semsix=six semone=one semtwo=two semthree=three semfour=four ///
 semfive2=five2 semsix2=six2 semone2=one2 semtwo2=two2 semthree2=three2 semfour2=four2 ///
 , by(treat)

gen hiy=roll2+1.96*semq2
gen lowy=roll2-1.96*semq2

graph twoway (bar roll2  treat if treat>20, recast(scatter) col(plr1) fxsize(100) ///
fi(50) ylabel(0(1)4) legend(off) xlabel(21 "2S" 22 "1S") ///
ylabel(0 1 2  3 4,  labcol(black)) ///
 yline(2.5, lcol(ply1) ) yline(1.53, lcol(plb1) lpat(solid)) ytick(0(1)4.2) ///
  )  ///
(rcap hiy lowy treat if treat>20 ,lc(black) ) 	, title("Mean") xtitle("")  ///
nodraw name(mean, replace) scheme(plotplainblind)

gen fiveh=five+1.96*semfive
gen fivel=five-1.96*semfive
twoway (bar five treat if treat>20 , col(plr1)  recast(scatter) fxsize(110) ///
 fi() legend(off) xlabel(21 "2S" 22 "1S") xtitle("")) ///
(rcap fiveh fivel treat if treat>20 ,lc(black) title("5")   ///
 yline(.16666667, lcol(ply1) ) yline(.02777778, lcol(plb1) lpat(solid)) ///
 ylabel(0(0.1)0.42, grid gmin gmax) ///
 name(five, replace) nodraw)
 
gen fourh=four+1.96*semfour
gen fourl=four-1.96*semfour
twoway (bar four treat if treat>20 , col(plr1)   recast(scatter) fxsize(80) ///
 fi() legend(off) xlabel(21 "2S" 22 "1S") xtitle("") ) ///
(rcap fourh fourl treat if treat>20 ,lc(black) title("4")  ///
yline(.16666667, lcol(ply1) ) yline(.08333333, lcol(plb1) lpat(solid)) ///
 ylabel(none) ytick(0(.1).42, grid gmin gmax) ///
nodraw name(four, replace)) 

gen threeh=three+1.96*semthree
gen threel=three-1.96*semthree
twoway (bar three treat if treat>20 , col(plr1)  recast(scatter) fxsize(80) ///
 fi() legend(off) xlabel(21 "2S" 22 "1S") xtitle("")) ///
(rcap threeh threel treat if treat>20 ,lc(black) title("3")  ///
yline(.16666667, lcol(ply1) ) yline(.13888889, lcol(plb1) lpat(solid))  ///
 ylabel(none) ytick(0(.1).42, grid gmax gmin) ///
 nodraw name(three, replace))  

gen twoh=two+1.96*semtwo
gen twol=two-1.96*semtwo
twoway (bar two treat if treat>20 , col(plr1)  recast(scatter) fxsize(80) ///
 fi() legend(off) xlabel(21 "2S" 22 "1S") xtitle("")) ///
(rcap twoh twol treat if treat>20 ,lc(black) title("2")  ///
yline(.16666667, lcol(ply1) ) yline(.19444444, lcol(plb1) lpat(solid))  ///
 ylabel(none) ytick(0(.1).42, grid gmax) ///
 nodraw name(two, replace))  

gen oneh=one+1.96*semone
gen onel=one-1.96*semone
twoway (bar one treat if treat>20 , col(plr1)  recast(scatter) fxsize(80) ///
 fi() legend(off) xlabel(21 "2S" 22 "1S") xtitle("")) ///
(rcap oneh onel treat if treat>20, lc(black) title("1")  ///
yline(.16666667, lcol(ply1) )    yline(.25, lcol(plb1) lpat(solid))   ///
 ylabel(none) ytick(0(.1).42, grid gmax) ///
  nodraw name(one, replace))  

gen sixh=six+1.96*semsix
gen sixl=six-1.96*semsix
twoway (bar six treat if treat>20 , col(plr1)  recast(scatter) fxsize(80) ///
 fi() legend(off) xlabel(21 "2S" 22 "1S") xtitle("")) ///
(rcap sixh sixl treat if treat>20, lc(black) title("0")  /// 
 yline(.16666667, lcol(ply1) )  lpat(solid) yline(.3055556, lcol(plb1) lpat(solid))  ///
 ylabel(none) ytick(0(.1).42, grid gmax) ///
	nodraw name(six, replace))  
  
gr combine mean five four three two one six, row(1) xsize(5) ysize(3) ///
 imargin(none) scale(2.8) title("2nd Roll, Unincentivised", size( vsmall  )) ///
 name(temp2, replace) 
graph export "output/figure4b.pdf", as(pdf) replace

 
 exit 

 

 
 